<!--
医院管理-医院维护修改
 add by yyp 2020-01-12
-->
<template lang="pug">
  kalix-dialog.user-add(bizKey="Hospital" ref="kalixBizDialog"
  v-bind:formModel.sync="formModel" v-bind:targetURL="targetURL")
    div.el-form(slot="dialogFormSlot" style=" width:60%;margin:auto;")
      el-form-item(label="医院名称" prop="hospitalName" v-bind:label-width="labelWidth" v-bind:rules="rules.hospitalName")
        el-input(v-model="formModel.hospitalName" style="width:80%" disabled="true")
      el-form-item(label="医院地址" prop="hospitalAdress" v-bind:label-width="labelWidth" v-bind:rules="rules.hospitalAdress")
        el-input(v-model="formModel.hospitalAdress" style="width:80%")
      el-form-item(label="医院LOGO" prop="hospitalLogo" v-bind:label-width="labelWidth" v-bind:rules="rules.hospitalLogo")
        kalix-upload(v-model="formModel.hospitalLogo" v-bind:isImage="true" style="width:100%")
</template>

<script type="text/ecmascript-6">
  import FormModel from './model'
  import {HospitalURL} from '../../config.toml'
  import KalixClansmanUpload from '../../../../../components/fileUpload/upload'
  import {baseURL} from '../../../../../config/global.toml'
  import KalixSelect from '../../../../../components/corelib/components/common/baseSelect'
  export default {
    name: 'hospitalEdit',
    components: {
      KalixSelect,
      KalixClansmanUpload
    },
    data() {
      // let validateHospitalName = (rule, value, callback) => {
      //   if (value === null) {
      //     callback(new Error('请输入医院名称'))
      //   } else {
      //     this.axios.request({
      //       method: 'GET',
      //       url: HospitalURL + '/existUserBeanByLoginName/',
      //       data: '',
      //       params: {
      //         hospitalName: value
      //       }
      //     }).then(response => {
      //       if (response.data) {
      //         callback(new Error('该医院名称已被使用'))
      //       } else {
      //         callback()
      //       }
      //     }).catch(() => {
      //     })
      //   }
      // }
      return {
        action: baseURL + '/camel/rest/upload',
        formModel: Object.assign({}, FormModel),
        rules: {
          hospitalName: [{required: false, trigger: 'blur'}]
        },
        targetURL: HospitalURL,
        labelWidth: '150px'
      }
    }
  }
</script>

<style scoped lang="stylus" type="text/stylus">
  .el-form
    width 50%
    margin auto
    .radio
      margin-left 150px
      margin-bottom 20px
      .el-radio
        color: #3465cb
        font-weight: bold
        font-size: 14px
  .img-margin
    margin-left 150px
</style>
